<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../css/mui.css"/>
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/general.css"/>
		<link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css"/>
		<link rel="stylesheet" type="text/css" href="../css/mui.poppicker.css"/>
		<link rel="stylesheet" type="text/css" href="../css/lcs-pop.css"/>
		<link rel="stylesheet" type="text/css" href="../css/lcs-input-radio.css"/>
		<style type="text/css">
			.mdata{
				width: 100%;
				background-color: white;
				padding: 0.5em;
				display: flex;
				justify-content: flex-start;
				align-items: center;
			}
			.mimg{
				margin: 0.5em;
			}
			.mimg>img{
				width: 70px;
				height: 70px;
			}
			.mtext{
				display: flex;
				justify-content: center;
				align-items: flex-start;
				flex-direction: column;
			}
			input[type=radio]{
				margin: 0 10px;
			}
			.input-999{
				position: absolute;
				left: -999px;
			}
			.inpbut{
				width: 25%;
				/*width: 20%;
				height: 35px;
				border: 1px solid #C7C7C7;
				border-radius: 10px;
				background-color: white;
				text-align: center;
				line-height: 35px;*/
				margin: 2% 4%;
			}
			.inpbut>label{
				width: 100%;
				display: block;
				height: 35px;
				border: 1px solid #C7C7C7;
				border-radius: 10px;
				background-color: white;
				text-align: center;
				line-height: 35px;
			}
			.butlist{
				display: flex;
				justify-content: flex-start;
				align-items: center;
				flex-wrap: wrap;
				width: 100%;
				background-color: white;
			}
			.selectdiv{
				/*background-color: rgba(0,122,255,1);*/
				border: 0;
			}
			.selectdiv>label{
				color: white;
				background-color: rgba(0,122,255,1);
				border: 0;
			}
			
			.jinediv{
				width: 100%;
				margin: 0.5em 0;
				background-color: white;
			}
			.jinediv>div{
				padding: 0 0 0.2em 0;
			}
			.ddiv{
				width: 100%;
				background-color: white;
				padding: 11px 15px;
				margin: 0.5em 0;
			}
			.ddiv>.border-b{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0.5em;		
			}
			
			
			.mui-input-row label {
    font-family: 'Helvetica Neue',Helvetica,sans-serif;
    line-height: 1.1;
    float: left;
    width: 50%;
    padding: 11px 15px;
}
.mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea {
    float: right;
    width: 50%;
    margin-bottom: 0;
    padding-left: 0;
    border: 0;
}
.divright{
	display: flex;
	justify-content: flex-end;
}

*{
	font-size: 0.95em;
}
.flex-row-around{
	width: auto !important;
}

.mui-table-view-cell {
    position: relative;
    overflow: hidden;
    padding: 11px 15px;
    -webkit-touch-callout: none;
}
.yuangong{
	width: 100%;
	display: flex;
	
}
.listdivmain{
	height: auto !important;	
	padding: 0.5em;
	font-size: 1.2em !important;
}
.listdivmain>div {
    width: 90%;
    padding: 0.2em 0.5em;
    border-bottom:0;
    margin: 0.2em auto;
}
.listdivmain>div:first-child {
    border-bottom: 1px solid #c7c7c7;
}
.listdivmain>div>div {
	padding: 0.5em 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
input[type=text]{
    line-height: 21px;
    width: 40% !important;
    height: 30px;
    margin-bottom: 0;
    padding: 2px 5px;
    -webkit-user-select: text;
    border: 0 !important;
    border-bottom: 1px solid #C7C7C7 !important;
    outline: 0;
    background-color: white !important;
    -webkit-appearance: none;
}

input[type=radio] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: absolute !important;
    display: inline-block;
    vertical-align: top;
    width: 2em;
    height: 2em;
    border: 1px solid #00bfff;
    outline: none;
    cursor: pointer;
    -webkit-border-radius: 20px;
    -moz-border-radius: 20px;
    border-radius: 20px;
}





.menu{
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  box-sizing: border-box;
  height: auto;
  width: 3em;
  padding: 0.5em;
  border-radius: 5px;
  background: white;
  box-shadow: 0 4px 64px rgba(0, 0, 0, 0.15);
  transition: 1.3s cubic-bezier(0.53, 0, 0.15, 1.3);
  z-index: 2;
  right: 0;
}
.menu.expanded {
  height: auto;
  width: 100%;
}
.menu span {
  white-space: nowrap;
  visibility: visible;
  opacity: 1;
  transition: .3s;
  transform: rotateY(0deg);
}
.span{
	
}
.menu span:nth-of-type(1) {
  transition-delay: .4s;
}
.menu span:nth-of-type(2) {
  transition-delay: .5s;
}
.menu span:nth-of-type(3) {
  transition-delay: .6s;
}
.menu span:nth-of-type(4) {
  transition-delay: .7s;
}
.menu span.hidden {
  width: 0;
  visibility: hidden;
  opacity: 0;
  transform: rotateY(90deg);
}
.menu span.hidden:nth-of-type(1) {
  transition-delay: .3s;
}
.menu span.hidden:nth-of-type(2) {
  transition-delay: .2s;
}
.menu span.hidden:nth-of-type(3) {
  transition-delay: .1s;
}
.menu span.hidden:nth-of-type(4) {
  transition-delay: 0s;
}
.menu a {
  text-decoration: none;
  text-transform: uppercase;
  color: #333333;
  padding: 5px;
  transition: .3s;
}
.menu a:hover {
  color: #D84315;
}
.container {
  order: 1;
  width: 20px;
  height: 24px;
  padding: 5px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.container:hover .toggle:before {
  top: -9px;
}
.container:hover .toggle:after {
  bottom: -7px;
}
.container .toggle {
  position: relative;
  width: 100%;
  height: 2px;
  background: #aaaaaa;
}
.container .toggle:before {
  position: relative;
  display: flex;
  top: -7px;
  height: 2px;
  width: 100%;
  background: #aaaaaa;
  content: "";
  transition: top .25s ease, bottom .25s ease, transform .5s ease;
}
.container .toggle:after {
  position: relative;
  display: flex;
  bottom: -5px;
  height: 2px;
  width: 100%;
  background: #aaaaaa;
  content: "";
  transition: top .25s ease, bottom .25s ease, transform .25s ease;
}
.container .toggle.close {
  height: 0;
}
.container .toggle.close:before {
  transform: rotate(45deg);
  top: 0;
}
.container .toggle.close:after {
  transform: rotate(-45deg);
  bottom: 2px;
}
.rightmenu{
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}
.textdiv{
	position: absolute;
	left: 10px;
}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav hbg">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left colorw"></a>
		    <h1 class="mui-title">快速充值</h1>
		</header>
		<div class="mui-content">
		    <div class="mdata" id="memberid">
		    	<div class="mimg">
		    		<img class="border50" id="memhimg" src="../img/member-header.png"/>
		    	</div>
		    	<div class="mtext">
		    		<span id=""></span>
		    		<span class="fe08">卡号：</span>
		    		<span class="fe08">会员等级：   <span style="padding-left: 1em;">积分：</span></span>
		    	</div>
		    </div>
		    <div style="padding: 0.5em;" class="fe09 rightmenu">
		    	<div class="textdiv">
		    		快速选择充值金额
		    	</div>
		    	<!--
                	作者：592176224@qq.com
                	时间：2019-03-12
                	描述：
                -->
		    	<div class="menu">
		    	<!--
                	作者：592176224@qq.com
                	时间：2019-03-05
                	描述：
                -->
				<div class="container">
					<div class="toggle"></div>
				</div>
				<span id="addid" class="span hidden" onclick="addmark()"><a href="#">添加 </a></span>
				<span id="delid" class="span hidden" ><a href="#">删除</a></span>
			</div>
		    </div>
		    <div class="butlist" id="rechargelist">
		    		<!--
                    	作者：592176224@qq.com
                    	时间：2019-03-05
                    	描述：
		    	<div class="inpbut">
		    			<label for="100">￥100</label>
		    			<input class="input-999" type="radio" name="sradio" id="100" value="100" />
		    	</div>
                    -->
		    </div>
		    
		    <div class="jinediv">
		    		<div class="mui-input-row border-b">
		    		    <label>充值金额：</label>
		    		    <input id="recharge_money" type="number" placeholder="输入充值金额">
		    		</div>
		    		<div class="mui-input-row">
		    		    <label>赠送金额：</label>
		    		    <input id="give_money" type="number" placeholder="输入赠送金额">
		    		</div>
		    </div>
		    
		    <div class="ddiv">
		    	<span id="pay_money">
		    		实际到账：
		    	</span>
		    </div>
		    
		    <div class="ddiv">
		    	<div class="border-b">
		    		<div id="">
		    			选择员工
		    		</div>
		    		<div id="selectmember">
		    			点击选择
		    		</div>
		    	</div>
		    	<div class="tc_money" id="ullist">
		    		<!--
                    	作者：592176224@qq.com
                    	时间：2019-02-21
                    	描述：
                    
		    		<ul id="" class="mui-table-view">
			    		<li class="mui-table-view-cell">
							<div class="mui-slider-right mui-disabled">
                                <a name="setyg" class="mui-btn mui-btn-grey">修改</a>
								<a name="delyg" class="mui-btn mui-btn-yellow">删除</a>
							</div>
							<div class="mui-slider-handle">
								<div class="mui-table-cell">
									张三
								</div>
							</div>
						</li>
					</ul>
					-->
		    	</div>
		    	
		    	
		    </div>
		    
		    <div class="fgd"></div>
		    <div class="footdiv">
		    	<div class="fleft" id="fid">
		    		应付金额：￥0.00
		    	</div>
		    	<div class="fright" onclick="before_filling()">
		    		立即充值
		    	</div>
		    </div>
		    <div id="popover" class="mui-popover">
			   <div class="listdiv">
			   		<div class="listdivmain" id="listdivmain">
							<div class="">
								<div class="flex-row-around">
                                	<span id="">员工：</span>
                                	<span id="memberspan" data-mid="">选择</span>
								</div>
								<div class="flex-row-around">
                                	<span id="">职位：</span>
									<span id="rname"></span>
								</div>
								<div class="flex-row-around">
									<span id="">指定：</span>
									<input id="appoint" type="checkbox">
								</div>
							</div>
							<div class="">
								<div class="flex-row-around">
									<span id="">提成率</span>
									<input id="proportion" type="text">
									<span id="">%</span>
								</div>
								<div class="flex-row-around">
									<span id="">提成金额</span>
									<input id="amount" type="text">
									<span id="">元</span>
								</div>
							</div>
							<div class="">
								<!--
                                	作者：592176224@qq.com
                                	时间：2019-02-20
                                	描述：
                                	<button type="button" class="mui-btn mui-btn-blue">添加</button>
                                -->
									<button id="addygbut" type="button" class="mui-btn mui-btn-blue mui-btn-block">添加</button>
							</div>
			   		</div>
			   </div>
			</div>
			<!--
            	作者：592176224@qq.com
            	时间：2019-02-21
            	描述：
            
		    <div id="popover" class="mui-popover">
			   <div class="listdiv">
			   		<div class="ssdiv">
			   			<input id="keyvalue" type="" name="" id="" value="" placeholder="输入卡号/电话/名称"/>
			   			<div class="ssdivright hbg" onclick="recharge()">搜索</div>
			   		</div>
			   		<div class="listdivmain" id="listdivmain">
			   			
			   		</div>
			   </div>
			</div>
			-->
		</div>
		<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/mui.min.js"></script>
		<script src="../js/mui.picker.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/mui.poppicker.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/req.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/muishow.js" type="text/javascript" charset="utf-8"></script>
		<!--
        	作者：592176224@qq.com
        	时间：2019-02-15
        	描述：
        	<script src="../js/lcs-pop.js" type="text/javascript" charset="utf-8"></script>
        -->
		<script type="text/javascript">
			var mid = 0,//会员id
			pay_money = 0,//实际到账
			recharge_money = 0,//充值金额
			give_money = 0,//赠送金额
			percent_point = 0,//比例
    		percent_money = 0,//金额
    		percent = [],//提成参数
    		ygid = 0, //员工id
    		employee_id = 0,
    		zdyid = 0;	//自定义金额id
    		
			var zdtype = 1;
			var role_id = 0; //提成角色id
			var product_id = 0; //提成商品id
			
			var appoint_money = 0, 		//指定提成金额
			    appoint_percent = 0,		//指定提成比例
			    non_appoint_money = 0,	//非指定金额
			    non_appoint_percent = 0,	//非指定比例
			    tc_type = 1,				//提成类型 比例或金额
			    is_appoint = 1;	//是否指定
			
			$(document).ready(function() {
				mui.init();
				mid = getrequest().mid;
				mui.plusReady(function(){
					mid = plus.webview.currentWebview().mid;
				})
				getrecharge_select();
				
				//菜单状态
				$('.container').on('tap', function() {
					$('.menu').toggleClass('expanded');
					$('.span').toggleClass('hidden');
					$('.container , .toggle').toggleClass('close');
				});
				g("delid").addEventListener("tap",function(e){
					delmark()
				})
				//单选指定按钮
			    $('input[type=radio][name=zhiding]').change(function(e) {
			        zdtype = this.value;
			        console.log(zdtype);
				});
				
				
				//监听pop
				g("selectmember").addEventListener('tap',function(e){
                	mui('#popover').popover('toggle',document.getElementById("popover"));
                	//getemployee();
                })
				
				//计算金额
				$('#recharge_money').bind('input propertychange', function() {
				  var val =  $(this).val();
				  recharge_money = val;
				  g("fid").innerHTML = "应付金额：￥" + recharge_money;
				  setpay_money();
				});
				
				//监听金额
				$('#give_money').bind('input propertychange', function() {
				  var val =  $(this).val();
				  give_money = val;
				  setpay_money();
				});
				
				//监听删除员工
				mui('body').on('tap', '.mui-table-view .mui-btn', function(event) {
					var elem = this;
					var li = elem.parentNode.parentNode;
					delygf(elem,li)
				});
				//添加员工提成信息
				$("#addygbut").on("tap",function(e){
            		var avalue = g("amount").value;
            		var pvalue = g("proportion").value;
            		var ename = g("memberspan").innerText;
            		var edata = {
            			"employee_id":employee_id,
            			"percent_point":pvalue,
	    				"percent_money":avalue, 
	    				"ename":ename,
	    				"appoint_money":appoint_money,
	    				"appoint_percent":appoint_percent,
	    				"non_appoint_money":non_appoint_money,
	    				"non_appoint_percent":non_appoint_percent,
	    				"tc_type":tc_type,
	    				"is_appoint" :is_appoint,
            		}
            		percent.push(edata);
            		setullist(percent);
            		mui('#popover').popover('hide');
            		appoint_money = 0;
	                appoint_percent = 0;
	                non_appoint_money = 0;
	                non_appoint_percent = 0;
	                tc_type = 1;
            		setvalue("","");
            		g("memberspan").innerHTML = "选择";
					g("rname").innerHTML = "";
            		g("proportion").value = "";
			    	g("amount").value = "";
			    	g("appoint").checked = false;
	            })
				
				//设置提成
				$("#listdivmain").on("tap","#appoint",function(e){
                    		console.log("设置是否指定");
                    		var money = appoint_money,
	                       		per = appoint_percent,
	                       		non_money = non_appoint_money,
	                       		non_percent = non_appoint_percent,
	                       		type = tc_type;
                    		//指定
                    		 	if(type == 1){
                    		 		var p = 0;
                    		 		console.log($(this)[0].checked);
	                       			if(!$(this)[0].checked){
	                       				is_appoint = 1;
	                       				p = per;
	                       			}else{
	                       				is_appoint = 2;
	                       				p = non_percent;
	                       			}
	                       			var val = calculate(recharge_money,p);
	                        		setvalue(p,val);
                    		 	}else{
                    		 		var val = 0;
	                       			if(!$(this)[0].checked){
	                       				is_appoint = 1;
	                       				val = money;
	                       			}else{
	                       				is_appoint = 2;
	                       				val = non_money;
	                       			}	
                    		 		//提成设置的金额
	                        		setvalue("",val);
                    		 	}
                    	})
				
				getmember();
				setaddEventListener();
			});
			
			//获取自定义金额列表
			function getrecharge_select(){
				var data = {
					url:"/api/recharge_select/lst",
					data:{
						access_token:acctoken(),
					}
				}
				ajax(data,function(res){
					console.log("自定义金额列表",res);
					//自定义金额最多6个
					setrecharge_select(res.data);
					/*if(res.data.length >= 6){
						$("#addid").addClass("hidden");
					}else{
						$("#addid").removeClass("hidden");
					}*/
				})
				
			}
			//设置自定义金额列表
			function setrecharge_select(list){
				var str = '';
				$.each(list, function(index,item) {
					str += '<div class="inpbut">'+
		    			'<label for="'+item.id+'">￥'+item.money+'</label>'+
		    			'<input class="input-999" type="radio" name="sradio" id="'+item.id+'" value="'+item.money+'" />'+
		    			'</div>';
		    		if(index >= 5){
		    			return false;
		    		}
				});
				g("rechargelist").innerHTML = str;
				
				//单选金额按钮
				$('input[type=radio][name=sradio]').change(function(e) {
			        var radios = $('input[type=radio][name=sradio]');
			        for(var i = 0; i < radios.length; i++){
			        	if(this.value == radios[i].value){
			        		//console.log(this.id);
			        		zdyid = this.id;
			        		var f = $(radios[i]).parent();
			        		f.addClass('selectdiv');
			        		recharge_money = this.value;
			        		g("recharge_money").value = this.value;
						  	g("fid").innerHTML = "应付金额：￥" + recharge_money;
						  	setpay_money();
			        	}else{
			        		var f = $(radios[i]).parent();
			        		f.removeClass('selectdiv');
			        	}
			        }
			        
				});
				
				
				
			}
			
			//添加金额
			function addmark(){
				mui.prompt("请输入金额？","","",["取消","确认"],function(e){
					if(e.index == 1){
						var data = {
							url:"/api/recharge_select/add",
							data:{access_token:acctoken(),money:e.value}
						}
						ajax(data,function(res){
							console.log(res);
							mui.toast(res.msg);
							getrecharge_select();
						})
					}
				})
			}
			
			//删除自定义金额
			function delmark(){
				if(zdyid == 0 || zdyid == "0"){
					mui.toast("请选择需要删除的金额");
					return;
				}
				mui.confirm("确认删除？","",["取消","确认"],function(e){
					if(e.index == 1){
						var data = {
							url:"/api/recharge_select/del",
							data:{access_token:acctoken(),id:zdyid}
					}
					ajax(data,function(res){
						console.log(res);
						mui.toast(res.msg);
						getrecharge_select();
					})
					}
					
				})
			}
			
			//设置 提成员工
			function setullist(plist){
				var str = '<ul id="" class="mui-table-view">'
				for(var i = 0; i < plist.length; i++){
					str +=  '<li class="mui-table-view-cell">'+
						'<div class="mui-slider-right mui-disabled">'+
						'<a name="delyg" index="'+i+'" class="mui-btn mui-btn-yellow">删除</a>'+
						'</div><div class="mui-slider-handle">'+
						'<div class="mui-table-cell">'+
						plist[i].ename +
						'</div></div></li>';
				}
				str += '</ul>';
				g("ullist").innerHTML = str;
				
			}
			
			//删除提成员工
			function delygf(elem,li){
				var btnArray = ["取消","确定"];
				mui.confirm('确认删除该员工？', '', btnArray, function(e) {
					if (e.index == 1) {
						var index1 = elem.getAttribute("index");
						percent.splice(index1,1);
						setullist(percent);
					} else {
						setTimeout(function() {
							mui.swipeoutClose(li);
						}, 0);
					}
				});
			}
			
			//获取员工列表
			function setaddEventListener(){
				var data = {
					url:"/api/employee/lst",
					data:{
						access_token:acctoken(),
						type:1
					}
				}
				ajax(data,function(res){
					console.log("员工列表",res);
					var list1 = [];
					var datalist = res.data.data;
					for(var i = 0;i < datalist.length; i++){
						var rid = 0; rname = '';
						if(datalist[i].role&&datalist[i].role.id){
							rid = datalist[i].role.id;
							rname = datalist[i].role.role_name
						}
				 		var str = {
				 			value:datalist[i].id,
				 			text:datalist[i].username,
				 			rid:rid,
				 			rname:rname
				 		}
						list1.push(str);
					}
					memberlist = list1;
					setpopover(memberlist);
				})
				
							
					}
			
			//设置pop
			function setpopover(memberlist){
				var addmemberidPicker = new mui.PopPicker();
				addmemberidPicker.setData(memberlist);
				var level = g("memberspan");
				var rname = g("rname");
	                level.addEventListener('tap', function(event) {
	                    addmemberidPicker.show(function(items) {
	                        level.innerText = items[0].text;
	                        employee_id = items[0].value;
	                        level.datamid = items[0].value;
	                        var rid = items[0].rid;
	                        level.innerHTML = items[0].text;
	                        rname.innerHTML = items[0].rname;
	                       	var data = {
	                       		url:"/api/recharge_percent/detail",
	                       		data:{
	                       			access_token:acctoken(),
	                       		}
	                        }
	                       	ajax(data,function(res){
	                       		console.log("提成关系",res);
	                       		appoint_money = res.data.appoint_money;
	                       		appoint_percent = res.data.appoint_percent;
	                       		non_appoint_money = res.data.non_appoint_money;
	                       		non_appoint_percent = res.data.non_appoint_percent;
	                       		tc_type = res.data.type;
	                        	if(res.data.type == 1){
	                        		var val = calculate(recharge_money,non_appoint_percent)
	                        		setvalue(non_appoint_percent,val);
	                        	}else{
	                        		setvalue(0,non_appoint_money);
	                        	}
	                       	})
	                    });
	                   
						});
						
						
						
					}
			
			//用于计算 提成金额
			function calculate(m,p){
				return (m*(p/100)).toFixed(2);
			}
			
			//设置提成值
			function setvalue(per,money){
	            g("proportion").value = per||"";
			    g("amount").value = money||"";
			}
			
			
			//计算实际到账金额
			function setpay_money(){
				var rech = parseFloat(recharge_money);
				var give = parseFloat(give_money);
				var pay = rech + give; 
				console.log(pay);
				if(pay < 0){
					pay = 0.00;
				}
				pay_money = pay;
				g("pay_money").innerHTML = "实际到账：￥" + pay_money;
			}
			
			//获取会员单个详情
			function getmember(){
				var data = {
					url:"/api/member/detail",
					data:{
						access_token:acctoken(),id:mid
					}
				}
				ajax(data,function(res){
					console.log("会员详情",res);
					setmemberlist(res.data);
				})
			}
			//设置会员信息
			function setmemberlist(data){
				var str = '<div class="mimg">';
				if(data.images&&data.images.path_name){
					str += '<img class="border50" src="'+data.images.path_name+'"/>';
				}else{
					str += '<img class="border50" src="../img/member-header.png"/>';
				}
		    	str += '</div><div class="mtext"><span id="">'+
		    		data.username+
		    		'</span><span class="fe08">卡号：'+
		    			data.card_number+
		    		'</span><span class="fe08">余额：'+
		    			data.stay_money +
		    		'<span style="padding-left: 1em;">积分：'+
		    		data.use_score+
		    		'</span></span></div>';
				g("memberid").innerHTML = str;
			}
			function before_filling(){
				var rech = g("recharge_money").value;
				if(null == rech || "" == rech || rech < 0){
					mui.toast("请输入充值金额")
					return;
				}
				var give = g("give_money").value||0;
				var list = percent;
				
				//充值前 先计算提成
				list.forEach(function(item,index){
					var val = 0;
					if(item.tc_type == 1){
						if(is_appoint == 1){
							val = calculate(rech,item.appoint_percent);
						}else{
							val = calculate(rech,item.non_appoint_percent);
						}
					}else{
						if(is_appoint == 1){
							val = item.appoint_money;
						}else{
							val = item.non_appoint_money;
						}
					}
					list[index]['percent_money'] = val;
					delete item["ename"];
					delete item["appoint_money"];
					delete item["appoint_percent"];
					delete item["non_appoint_money"];
					delete item["non_appoint_percent"];
					delete item["tc_type"];
					delete item["is_appoint"];
				})
				var data = {
					member_id:mid,
					recharge_money:rech,
					give_money:give,
					pay_money:rech,
					percent:list
				}
				mui.openWindow({
				    url: 'childPages/paypage.html', 
				    id: 'paypage',
				    extras:data
				 });
			}
			
			function gopage(url){
				mui.openWindow({
				    url: 'childPages/'+url +'.html', 
				    id: url
				 });
			}
		</script>
	</body>

</html>